<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis;


class UserController extends Controller
{


    public function index() {
        $res = ["stat" => 0, "msg" => "error"];
        $t5 = microtime(true);
        $redis = Redis::connection();
        $flag = false;
        if (!$flag) {
            $key = "user:name:111";
            $v = "abcd";
            Redis::set($key, $v);
        }
        if (Redis::exists($key)) {
            $data = Redis::get($key);
        }
        $t6 = microtime(true);
        $tt = (($t6 - $t5) * 1000) . 'ms';
        $res["data"]    = $data;
        $res["runtime"] = $tt;
        echo json_encode($res);
    }

    public function showProfile($id){
		$user =Redis::get('user:profile:'.$id);

	}


}

